<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>
<%@ taglib prefix='sec'	uri='http://www.springframework.org/security/tags'%>

<script type="text/javascript" src="resources/scripts/lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="resources/scripts/custom/custom.js"></script>

<!--Include this for enabling chat-->
<script type="text/javascript" language="javascript" src="chat/ijab_config.js"></script>
<script type="text/javascript" language="javascript" src="chat/ijab_i18n_en.js"></script>
<script type="text/javascript" language="javascript" src="chat/ijab/ijab.nocache.js"></script>
<script type="text/javascript">
		function loginiJab (){

    	var userName='<sec:authentication property="principal.user.userName" />';
		var password='<sec:authentication property="principal.user.password" />';

		if(userName == ""||password=="")
    	{
    		alert("username or password is empty!");
    	};
    	
		userName=userName+'@'+iJabConf.xmpp.domain;
		
    	iJab.login(userName,password);
  };
  
  		
</script>
<!-- Chat code till here-->

<html>

<head>
<title>Home</title>
</head>

<body onload="loginiJab ()">
		 
		<a href=<c:url value='/j_spring_security_logout'/>>Logout</a> <br /> 
		<a href=<c:url value='forums/list.page'/>>Forums</a> <br />

		<div>
			<button type='button' onclick='restGet()'>Get Courses</button>
			
			<table id="data"></table>

		</div>

		<sec:authorize ifAnyGranted='ROLE_ADMIN'>
			<h1>Only admin can see this</h1>

			<a href='admin'> Admin Home </a>
		</sec:authorize>
		<h1>Welcome</h1>
	
</body>

</html>
